# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=deepin-font-manager
pkgver=6.0.2
pkgrel=1
pkgdesc='A font management tool for Deepin desktop'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/deepin-font-manager"
license=('GPL3')
depends=('deepin-qt5integration' 'dtkcore' 'dtkgui' 'dtkwidget' 'qt5-base' 'fontconfig' 'freetype2' 'gcc-libs')
makedepends=('cmake' 'deepin-file-manager' 'ninja' 'qt5-tools')
optdepends=('deepin-file-manager: font preview in file manager')
groups=('deepin-extra')
source=("https://github.com/linuxdeepin/deepin-font-manager/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('9d29738b80c10310c12a04e2149e4c3ed7a39c5a74d8beb64d406d2ce5bf282c83c741923cff569c041cc13051e6c49ade04686bc1e464a194220911e694f648')

prepare() {
  cd deepin-font-manager-$pkgver

  # Fix linker flags
  sed -i 's/CMAKE_EXE_LINKER_FLAGS "-pie"/CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie"/' deepin-font-manager/CMakeLists.txt
}

build() {
  cd deepin-font-manager-$pkgver
  cmake -GNinja . -DPLUGIN_INSTALL_DIR=  -DCMAKE_INSTALL_PREFIX=/usr
  ninja
}

package() {
  cd deepin-font-manager-$pkgver
  DESTDIR="$pkgdir" ninja install
}
